// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import Es6Promise from 'es6-promise'
Es6Promise.polyfill()
import App from './App'
import Cookies from './common/cookie'
//import Message from './components/message'
import VueCascader from 'vue-three-tier-cascader'
import store from './store'

import {
    Input, InputNumber,
    Select,Option,
    DatePicker, TimePicker,
    TimeSelect, Table, TableColumn,
    Dialog, Button, Checkbox,
    Message, Popover, Badge,
    Notification, Loading, Radio, Pagination,MessageBox,Tooltip, Card, Switch, Form, FormItem,
    Image,
} from 'element-ui'

import { EktQualityForm, EktBaseIcon, EktInputDialog, SayTable } from '@ektlang/common-ui'
Vue.use(EktQualityForm)
Vue.use(EktBaseIcon)
Vue.use(EktInputDialog)
Vue.use(SayTable)

Vue.component(Input.name, Input);
Vue.use(InputNumber);
Vue.use(Select);Vue.use(Option);
Vue.use(DatePicker);Vue.use(TimePicker);
Vue.use(TimeSelect);
Vue.use(Table);Vue.use(TableColumn);
Vue.use(Dialog);
Vue.use(Button);
Vue.use(Checkbox);
Vue.use(Popover);
Vue.use(Badge);
Vue.use(Radio);
Vue.use(Pagination);
Vue.use(Tooltip);
Vue.use(Card);
Vue.use(Switch)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Image)
Vue.use(Loading.directive);
Vue.prototype.$loading = Loading.service;
Vue.prototype.$Message = Message;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;

Vue.use(VueCascader)

window.Cookies = Cookies

window.throwErrorTips = (title="",msg="",zl)=>{
    // if(msg=='用户验证失败'){
    //     Vue.prototype.$Message({
    //         showClose: true,
    //         message: '用户验证失败，属未登录状态；即将回到登录页登录！',
    //         type: 'error'
    //     });
    //     setTimeout(()=>{
    //         window.location = '/'
    //     },1000);
    //     return
    // }
    let message = '';
    title && msg ? message = title+'，ERROR：'+msg : message = title+msg;
    if(zl){
        message += zl
    }
    Vue.prototype.$Message({
        showClose: true,
        message: message,
        type: 'error',
        duration:5000
    });
}
let baseUrl = process.env.NODE_ENV == 'development' ? '/api' : ''
new Vue({
    el: '#app',
    store,
    template: '<App/>',
    components: { App },
    data:{
        cid:'',
        hisLisUrl:{
            '17':baseUrl+'/y/order/his',
            '19':baseUrl+'/zszl/his',
            '28':baseUrl+'/fy/his'
        },
        wxCid:['21','59'],
        lineCid:['19','28'],
        lineUrl:{
            '28':'/fy/line',
            '19':'/zszl/line'
        },
        hisErrTips:{
            '19':'；请联系管理员，技术维护·曾永强（电话/短信）：15218800445'
        },
        sOrderAttr:{
            '1':{name:'普通单',badge:'',style:'',lisClass:''},
            '2':{name:'预约单',badge:'预',style:'beforehand',lisClass:'yy'},
            '3':{name:'急单',badge:'急',style:'fast',lisClass:'fast-red'},
            '4':{name:'销单',badge:'销',style:'del',lisClass:''},
            '5':{name:'补单',badge:'',style:'repair',lisClass:''},
            '6':{name:'自发单',badge:'',style:'self',lisClass:''},
            '7':{name:'his',badge:'HIS',style:'his',lisClass:''},
            '8':{name:'his预约单',badge:'预',style:'beforehand',lisClass:'yy'},
            '9':{name:'his销单',badge:'销',style:'del',lisClass:''},
            '10':{name:'his急单',badge:'急',style:'fast',lisClass:'fast-red'},
            '11':{name:'夜间单',badge:'夜',style:'self',lisClass:''},
            '12':{name:'紧急单',badge:'紧急',style:'miss',lisClass:''},
            '13':{name:'特急单',badge:'特急',style:'faster',lisClass:'faster'},
            '14':{name:'his特急单',badge:'特急',style:'faster',lisClass:'faster'}
        },
        wOrderAttr:{
            '0':{name:'普通单',badge:'',style:''},
            '1':{name:'急单',badge:'急',style:'fast'},
            '2':{name:'预约单',badge:'预',style:'beforehand'},
            '3':{name:'销单',badge:'销',style:'del'},
            '4':{name:'自发单',badge:'自',style:'self'},
            '5':{name:'特急单',badge:'特急',style:'faster'}
        },
        sStatus:{
            "1":'配送中',
            "2":'已完成',
            "3":'配送中',
            "4":'发送成功'
        },
        ways:{
            '1':{txt:'公众号',show:true},
            '2':{txt:'网页端',show:true},
            '3':{txt:'小程序',show:true},
            '4':{txt:'系统',show:true},
            '5':{txt:'院内系统',show:true},
            '6':{txt:'APP',show:true},
            '0':{txt:'不显示端',show:false}
        },
        ssOffDuty:false,
        printHis:false,
        deadline:false,
        cloth_print:{
            show:false,
            row:{}
        },
        cloth_des: true,
        is_szy: process.env.ENV_CONFIG && process.env.ENV_CONFIG == 'szy'
    }
})
